﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using WL_Store.DAL;
using WL_Store.Model;

namespace WL_Store.BLL
{
   public  class CommodityInfoBLL
    {
        CommodityInfoDAL dal = new CommodityInfoDAL();

        /// <summary>
        /// 查询商品总数
        /// </summary>
        /// <returns></returns>
        public object CountBlurbs()
        {
            return dal.CountBlurbs();
        }

        /// <summary>
        /// 商品信息查询
        /// </summary>
        /// <returns></returns>
        //public List<CommodityInfoModel> GetCommodityInfosProc(CommodityInfoSearchModel searchModel)
        //{
        //    return dal.GetCommodityInfosProc(searchModel);
        //}
        /// <summary>
        /// 商品信息查询（proc）(分页)
        /// </summary>
        /// <returns></returns>
        public List<CommodityInfoModel> GetCommodityInfosProc(CommodityInfoSearchModel searchModel, int PageIndex, int PageSize, out int TotalCount)
        {
            return dal.GetCommodityInfosProc(searchModel,PageIndex,PageSize,out TotalCount);
        }

        //public DataTable GetCommodityInfos()
        //{
        //    return dal.GetCommodityInfos();
        //}

        /// <summary>
        /// 添加商品 返回true：添加成功 返回false：添加失败
        /// </summary>
        /// <param name="commod"></param>
        /// <returns></returns>
        public bool AddCommodityInfosProc(CommodityInfoModel commod)
        {
            return dal.AddCommodityInfosProc(commod);
        }
        /// <summary>
        /// 删除商品信息 返回true：删除成功；返回false：删除失败 
        /// </summary>
        /// <param name="commodityID"></param>
        /// <returns></returns>
        public bool DeleteCommodityInfoProc(int commodityID)
        {
            return dal.DeleteCommodityInfoProc(commodityID);
        }
        /// <summary>
        /// 根据commodityID查询信息
        /// </summary>
        /// <param name="commodityID"></param>
        /// <returns></returns>
        public CommodityInfoModel commodity(int commodityID)
        {
            return dal.commodity(commodityID);
        }
        /// <summary>
        /// 根据commodityID更改商品信息 返回ture：更改成功；返回false：更改失败
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateCommodityInfoProc(CommodityInfoModel model)
        {
            return dal.UpdateCommodityInfoProc(model);
        }

        /// <summary>
        ///查询商品类别
        /// </summary>
        /// <returns></returns>
        public DataTable GetCategory()
        {
            return dal.GetCategory();
        }


        /// <summary>
        /// 查询商品编号在数据库中是否存在，存在返回1,不存在返回0；
        /// </summary>
        /// <param name="number"></param>
        /// <returns></returns>
        public object GetBlurbComId(string comId)
        {
            return dal.GetBlurbComId(comId);
        }



    }
}
